﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IceZero.Business.Models
{
    public static class ActionStatisticExceptionCode
    {
        /// <summary>
        /// 错误消息字典
        /// </summary>

        private static readonly Dictionary<string, string> _msgDict;
        /// <summary>
        /// 简体中文
        /// </summary>
        public static readonly string langCN = "_cn";
        /// <summary>
        /// 英文
        /// </summary>
        public static readonly string langEN = "_en";
        /// <summary>
        /// 日语
        /// </summary>
        public static readonly string langJP = "_jp";
        /// <summary>
        /// 繁体中文
        /// </summary>
        public static readonly string langCNTW = "_cn-tw";

        static ActionStatisticExceptionCode()
        {
            _msgDict = new Dictionary<string, string>();
            InitMsgDict();
        }

        /// <summary>
        /// 通过code获取对应消息，没有匹配的返回null
        /// </summary>
        /// <param name="code"></param>
        /// <param name="lang"></param>
        /// <returns></returns>
        public static string GetMsg(string code, string lang = "_cn")
        {
            code += lang;
            if (!_msgDict.ContainsKey(code))
            {
                return null;
            }
            return _msgDict[code];
        }

        /// <summary>
        /// 没有找到此动作组
        /// </summary>
        public static string AC001 = "AC001";

        /// <summary>
        /// 传入的动作id和动作组id不匹配
        /// </summary>
        public static string AC002 = "AC002";

        /// <summary>
        /// 循环动作组第一次动作必须是正向的
        /// </summary>
        public static string AC003 = "AC003";

        /// <summary>
        /// 当前动作已经执行过
        /// </summary>
        public static string AC004 = "AC004";

        /// <summary>
        /// 当前动作只能执行一次
        /// </summary>
        public static string AC005 = "AC005";

        /// <summary>
        /// 初始化信息字典
        /// </summary>
        private static void InitMsgDict()
        {
            _msgDict.Add(AC001 + langCN, "没有找到此动作组");
            _msgDict.Add(AC001 + langEN, "not found this action combo");

            _msgDict.Add(AC002 + langCN, "传入的动作id和动作组id不匹配");
            _msgDict.Add(AC002 + langEN, "the instance of actionComboId don't have this actionId");

            _msgDict.Add(AC003 + langCN, "循环动作组第一次动作必须是正向的");
            _msgDict.Add(AC003 + langEN, "the loop action combo first action must be positive");

            _msgDict.Add(AC004 + langCN, "当前动作已经执行过");
            _msgDict.Add(AC004 + langEN, "this action is already do");

            _msgDict.Add(AC005 + langCN, "当前动作只能执行一次");
            _msgDict.Add(AC005 + langEN, "this action is already do");
        }
    }
}
